<template>
	<view>
		<view class="container">
			<view class="list" v-for="(item,key) in rebate_list" :key="key">
				 <view class="bonus-box">
					 <view class="bonus-tit">
					 	{{type_msg[item.type - 1] || '系统奖励'}}
					 </view>
					 <view class="bonus-msg" :class="{'isred':item.status==3}">
					 	{{status_msg[item.status-1] || '系统奖励'}}
					 </view>
					 <view class="bonus-time">
					 	{{ utils.timeTodate('Y-m-d H:i', item.create_time*1000) }}
					 </view>
				 </view>
				 <view class="bonus-money">
					 ¥{{item.total_amount}}
				 </view>
			</view>
			<view class="no_data" v-if="rebate_list.length==0">暂无记录</view>
		</view>
	</view>
</template>

<script>
	import utils from '@/components/shoyu-date/utils.filter.js';
	export default {
		data() {
			return {
				type_msg:['撰写奖励','分享奖励','分享奖励','作者奖励','作者奖励','抽奖奖励'],
				p:1,
				per:100000,
				rebate_list:[],
				utils: utils,
				status_msg:['待发放','发放成功','发放失败']
			}
		},
		onLoad() {
			var self = this;
			self.$request.request({
				url:'/user/rebate_record',
				success:function(res){
					if(res.code==200){
						self.is_load = true;
						var  y = res.result;
						y.forEach((item,index)=>{
							y[index].total_amount = self.$money(item.total_amount);
						});
						self.rebate_list = y;
					}else{
						
					}
				}
			});
			
			// #ifdef H5
			let share_time_line={
				title:self.$request.h5_share_name, // 分享标题
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			let share_app_message={
				title: self.$request.h5_share_name, // 分享标题
				desc: '我发现了一个很不错的商城，买家具有超大实惠！', // 分享描述
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			uni.setStorageSync('share_time_line',share_time_line);
			uni.setStorageSync('share_app_message',share_app_message);
			self.$request.wx_config()
			// #endif
		},
		onShareAppMessage(res) {
		    if (res.from === 'button') {
		      console.log(res.target)
		    }
		    return {
		      title: this.$request.share_title,
		      path: '/pages/index/index'
		    }
		  },
		methods: {
			
		}
	}
</script>

<style>
.container{
	display: flex;
	flex-direction: column;
	width: 95%;
	margin-left: 2.5%;
}
.list{
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	border-bottom: 1px solid #EEEEEE;
	padding: 20upx 0;
}
.bonus-box{
	display: flex;
	flex-direction: column;
}
.bonus-msg{
	color: #b6b6b6;
	font-size: 14px;
}
.bonus-time{
	color: #dcdcdc;
	font-size: 12px;
}
.bonus-money{
	align-self: center;
}
.isred{
	color: red;
}
.no_data{
	text-align: center;padding-top:50upx ;
}
</style>
